﻿// -------------------------------------------------------------------------
//    @FileName         :    NFSnsRoleSimple.h
//    @Author           :    gaoyi
//    @Date             :    2025-03-26
//    @Email			:    445267987@qq.com
//    @Module           :    NFSnsRoleSimple
//
// -------------------------------------------------------------------------

#pragma once

#include "proto_db.nanopb.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"
#include "NFServerComm/NFServerCommon/NFCacheDataTemplate.h"

class NFSnsRoleSimple : public NFCacheDataWithSaveDbTemplate<NFSnsRoleSimple, proto_ff::tbSnsRoleSimpleInfo, tbSnsRoleSimpleInfo, EOT_SNS_ROLE_SIMPLE>
{
public:
    NFSnsRoleSimple();
    ~NFSnsRoleSimple() override;
    int CreateInit();
    int ResumeInit();
public:
    uint64_t GetCacheId() const override { return m_stData.role_id; }
    int SendTransToDb(int iReason) override;
public:
    int InitData(const Proto_RoleSimpleInfo& info);
    int InitData(NFSnsRoleSimple* pRoleSimple);
    static int MakeInitData(proto_ff::Proto_RoleSimpleInfo& info, uint64_t roleId);
public:
    // Get:
    enSexType GetSex() const { return m_stData.role_info.sex; }
    enProfessionType GetProfession() const { return m_stData.role_info.profession; }
    int GetCe() const { return m_stData.role_info.ce; }
    int GetTransferId() const { return m_stData.role_info.transfer_id; }
    int GetDivision() const { return m_stData.role_info.division; }
    int GetLevel() const { return m_stData.role_info.level; }
    uint32_t GetAvatarId() const { return m_stData.role_info.avatar_id; }
    uint64_t GetGuildId() const { return m_stData.role_info.guild_id; }
    std::string GetName() const { return m_stData.role_info.name.c_str(); }
    std::string GetOpenId() const { return m_stData.role_info.open_id.c_str(); }
    std::string GetGuildName() const { return m_stData.role_info.guild_name.c_str(); }
    enGuildMemTitle GetGuildTitle() const { return m_stData.role_info.guild_title; }
    bool IsAddFriend() const { return m_stData.role_info.secret_set.is_add_friend; }
    uint64_t GetLastLogoutTime() const { return m_stData.role_info.last_logout_time; }
public:
    void SetRoleId(uint64_t roleId) { m_stData.role_id = roleId; m_stData.role_info.role_id = roleId; }
    uint64_t GetRoleId() const { return m_stData.role_id; }
};
